﻿<%@ Page Language="C#" MasterPageFile="~/BootstrapASP.Master"
    AutoEventWireup="true" CodeBehind="SearchResult.aspx.cs" Inherits="blog.Posts.SearchResult" Title="Search" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript" src="../INC/jquery-1.11.1.js"></script>
    <%--<script type="text/javascript" src="../INC/jquery.extend.js"></script>--%>
    <script type="text/javascript">
        
        $.ajaxWebService = function (url, dataMap, fnSuccess) {
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: url,
                data: dataMap,
                dataType: "json",
                success: fnSuccess
            });
        }
        $.fn.loadUserControl = function (id, page, action) {
            var $dom = this;
            if (page == "" || page == null) {
                page = location.pathname.replace("/", "");
            }
            page += "/RenderUserControl"; //RenderUserControl是PageProxy中的方法，不要轻易修改
            $.ajaxWebService(page, "{postid:'" + id + "',action:'" + action + "'}", function (result) {
                $dom.html(result.d);
            });
        }
    </script>

    <script type="text/javascript">
        var searchid = new Array();
        var searchidlist = SearchResult.getpostidlist().value;
        var totalcount = SearchResult.getresultcount().value;
        var paradiv = $("#postrelate");

        paradiv.html("");
        for (var i = 0; i < totalcount; i++) {
            //document.writeln(searchidlist[i]);
            var childdiv = $("<div></div>");
            childdiv.loadUserControl(searchidlist[i].toString(), null, "getlist");
            childdiv.attr('id', 'postlist' + i);
            childdiv.appendTo(paradiv);
        }
    </script>

    <div id="postrelate">
    </div>
</asp:Content>
